package demo1;

/**
 * @Author GocChin
 * @Date 2021/5/11 12:28
 * @Blog: itdfq.com
 * @QQ: 909256107
 * @Descript:
 */
public class WindowsTest extends Thread{
    private static int ticket=100;

    @Override
    public void run() {
       while (true){
           if (ticket>0){
               System.out.println(getName()+":买票，票号为："+ticket);
               ticket--;
           }else {
               break;
           }
       }
    }
}
class  Window{
    public static void main(String[] args) {
        WindowsTest w1 = new WindowsTest();
        WindowsTest w2 = new WindowsTest();
        WindowsTest w3 = new WindowsTest();
        w1.setName("窗口一");
        w2.setName("窗口二");
        w3.setName("窗口三");
        w1.start();
        w2.start();
        w3.start();
    }
}
